package com.fyzk.activity.setting;

import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.fyzk.base.BaseActivity;
import com.tyjc.lottery.R;
import com.fyzk.utils.HelpUrlConstants;
import com.fyzk.utils.LogUtil;
import com.fyzk.view.TopTitleView;


public class Helps extends BaseActivity{

	private TopTitleView helps_top_rl;
	private WebView news_webview;


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.helps);
		helps_top_rl = (TopTitleView)findViewById(R.id.helps_top_rl);
		helps_top_rl.setOnTitleClickListener(this);
		news_webview = (WebView)findViewById(R.id.news_webview);
		WebSettings webSettings = news_webview.getSettings();
		webSettings.setUseWideViewPort(true);
		webSettings.setLoadWithOverviewMode(true);
		webSettings.setSaveFormData(false);
		// 必须要打开javaScript
		webSettings.setJavaScriptEnabled(true);
		webSettings.setBuiltInZoomControls(true);
		webSettings.setSupportZoom(true);

		news_webview.setWebChromeClient(new WebChromeClient());
		news_webview.setWebViewClient(new MyWebViewClient());
		news_webview.loadUrl(HelpUrlConstants.Help_HELPCENTER);
	}

	private class MyWebViewClient extends WebViewClient {
		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			LogUtil.d("shouldOverrideUrlLoading>>>>"+url);
			return super.shouldOverrideUrlLoading(view, url);
		}
		@Override
		public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event) {
			return super.shouldOverrideKeyEvent(view, event);
		}

		@Override
		public void onPageFinished(WebView view, String url) {
			super.onPageFinished(view, url);
			LogUtil.d("onPageFinished>>>>" + url);
		}

		@Override
		public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
			super.onReceivedError(view, errorCode, description, failingUrl);
		}
	}


	/**
	 * Provides a hook for calling "alert" from javascript. Useful for
	 * 从javascript中提供了一个叫“提示框” 。这是很有用的
	 * debugging your javascript.
	 *  调试你的javascript。
	 */
	final class MyWebChromeClient extends WebChromeClient {
	}




}
